package com.simons.common.http.connPool;

import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.HttpClients;

import com.simons.common.http.BaseHttpClientOper;

/**
 * 

 * @Description:TODO

 * @author:jsm

 * @time:2017年9月15日 下午2:10:30
 */
public class PoolHttpClientOper extends BaseHttpClientOper{
	
	private static HttpClientConnManager httpClientConnManager = new HttpClientConnManager();
	
	public PoolHttpClientOper(){
		 if(httpClient == null){
           cookieStore = new BasicCookieStore();
           httpClient = HttpClients.custom()
        		   				   .setConnectionManager(httpClientConnManager.getClientConnectionManager())
        		   				   .setDefaultCookieStore(cookieStore)
        		   				   .setDefaultRequestConfig(httpClientConnManager.getRequestConfig())
        		   				   .build();
           localContext = HttpClientContext.create();
       }
	}
}
